package xju_5_6.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xju_5_6.dao.StuDao;
import xju_5_6.entity.Stu;
import xju_5_6.service.StuService;

import java.beans.Transient;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@Service
@Transactional
public class StuServiceImpl implements StuService {
    //  调用持久层
    @Autowired
    private StuDao stuDao;


    @Override
    @Transactional(timeout = 2,rollbackFor = Exception.class)
    public void insert(Stu stu) throws FileNotFoundException {
//        try {
//            Thread.sleep(4000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        stuDao.insert(stu);

        new FileInputStream("xxx");


//        int a = 10/0;
    }
}
